﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AdminApplication.Controls;
using AssessmentTool.PresentationLogic.Controllers;
using AssessmentTool.PresentationLogic;

namespace AdminApplication.PresentationLogic.Controllers
{
    public class ValidationPanelController : AbstractController<ValidationPanel>
    {

        public ValidationPanelController(ValidationPanel element)
            : base(element)
        {
            ed.subscrive("USERSELECTEDVALIDATION", userSelected);
            ed.subscrive("BACKLISTAUTENTI", hide);
            ed.subscrive("LOGOUT", logout);
            ed.subscrive("VIEWPROFILE", viewProfiles);
            ed.subscrive("BACKCOMPETENZE", viewCompetenze);
            ed.subscrive("CONSOLIDATO", hide);
        }
        public void logout(EventArgs e)
        {
            element.Visibility = Visibility.Collapsed;
        }
        public void hide(EventArgs e)
        {
            element.Visibility = Visibility.Collapsed;
        }
        public void userSelected(EventArgs e)
        {
            element.Visibility = Visibility.Visible;
            viewCompetenze(e);
            ed.dispatch("LOGGED-IN", null);
        }
        public void viewProfiles(EventArgs e)
        {
            ed.dispatch("STOPBUSY", null);
            MenuBuilder.getInstance().build("ADMIN-PROFILI");
            element.competenzeView.Visibility = Visibility.Collapsed;
            element.profiliView.Visibility = Visibility.Visible;

        }
        public void viewCompetenze(EventArgs e)
        {
            ed.dispatch("STOPBUSY", null);
            MenuBuilder.getInstance().build("ADMIN-COMPETENZE");
            element.competenzeView.Visibility = Visibility.Visible;
            element.profiliView.Visibility = Visibility.Collapsed;

        }
    }
    
}
